#include<iostream>
#include<pthread.h>
#include<unistd.h>
#include <sys/types.h>

void *run(void* args)
{
    while(true)
    {
        std::cout << "new thread, pid: " << getpid() << std::endl;
        sleep(1);
    }
    return nullptr;
    
}
int main()
{
    std::cout<<"I am a thread the pid is"<<getpid()<<std::endl;
    pthread_t tid; 
    int n=pthread_create(&tid,nullptr,run,(void*)"thread-1");
    if(n<0)
    {
        perror("crate thread false");
    }
    while(true)
    {
        std::cout<<"I am the main threa my pid is"<<getpid()<<std::endl;
        sleep(1);
    }


}
